<?php

namespace Biz\Winning;

use Base\Exception\NoRecordException;

class Winning extends \Base\BaseBiz
{
    /**
     * 获取信息
     */
    public static function getInfo($id)
    {
        $player_orm = new \Orm\WinningLog\WinningLogClass();
        $player_orm->loadById($id);

        return $player_orm;
    }

    /*
     * 获取列表
     */
    public static function getList($where, $now = 1, $size = 0)
    {
        $now = ($now > 0)?$now:1;
        $size = ($size > 0)?$size:\Util\Config::get('max_limit');

        $player_list = new \Orm\WinningLog\WinningLogList();
        if (!empty($where)) {
            $player_list['where'] = $where;
        } else {
            $player_list['where'] = '';
        }
        $player_list['limit'] = $size;
        $player_list['offset'] = ($now - 1) * $size;
        $player_list['order'] = '`insert_time` desc';
        $player_list['key_by'] = 'id';
        $player_list->load();

        $result = array();
        $result['lists'] = $player_list['lists'];
        $result['total'] = $player_list['total'];
        return $result;
    }
}
